%Task4.a

valid(Name):-
    person(Name,Age,_,_,_,Childen),
    check_age(Age,Childen).
check_age(_,[]).
check_age(ParentAge,[H|T]):-
    person(H,Age,_,_,_,_),
    N1 is Age + 15,
    ParentAge > N1,
    check_age(ParentAge,T).
    

parents(Name1,Name2,Child):-
    person(Name1,_,_,_,Clist1),
    person(Name2,_,_,_,Clist2),
    person(Child,_,_,_,_),
    member(Child,Clist1),
    member(Child,Clist2).

%Task5.

%isomorphic(Tree1,Tree2).
istree(tree(Left,Right)):-!,
    istree(Left),
    istree(Right).
istree(Element).

isomorphic(tree(LL,LR),tree(RL,RR)):-!,    
    isomorphic(LL,RL),
    isomorphic(LR,RR).

isomorphic(E1,E2):-
    istree(E1),
    istree(E2).
    